# -- coding: utf-8 --
"""
rho修正方程求解
"""

# third party lib
import numpy as np

def correct_rho_with_pressure(params: dict, p_prime_node: np.ndarray) -> np.ndarray:
    """密度修正计算
    Args:
        params: dict 计算需要的输入参


        p_prime_node: numpy ndarray float64, 压力误差修正量

    Returns:
        rho_g_prime_node: numpy ndarray float64, 气相密度
        rho_L_prime_node: numpy ndarray float64, 液相密度
    """
    rho_g_prime_node = (
        params["rho_g_derivate_p_node"] * p_prime_node
    )

    rho_L_prime_node = (
        params["rho_L_derivate_p_node"] * p_prime_node
    )

    rho_g_node = params["rho_g_node"]
    rho_L_node = params["rho_L_node"]
    rho_g_node += rho_g_prime_node
    rho_L_node += rho_L_prime_node
    return rho_g_node, rho_L_node

def correct_rho_with_temperature(params: dict, T_prime_node: np.ndarray) -> np.ndarray:
    """密度修正计算
    Args:
        params: dict 计算需要的输入参
    """
    rho_g_prime_node = (
        params["rho_g_derivate_T_node"] * T_prime_node
    )
    rho_L_prime_node = (
        params["rho_L_derivate_T_node"] * T_prime_node
    )
    rho_g_node = params["rho_g_node"]
    rho_L_node = params["rho_L_node"]
    rho_g_node += rho_g_prime_node
    rho_L_node += rho_L_prime_node
    return rho_g_node, rho_L_node

